using TodoPro.System.Event;

namespace TodoPro.System.Command
{
    public class ChangeFilterCommand : ITodoCommand
    {
        private TodoFilter mFilter;

        public ChangeFilterCommand(TodoFilter filter)
        {
            mFilter = filter;
        }
        
        public void Execute()
        {
            var todoModel = TodoProConfig.GetModel<ITodoModel>();

            todoModel.Filter = mFilter;
            
            TodoProConfig.SendEvent<OnFilterChangedEvent>();
        }
    }
}